package com.gblw.rjkf.pj.utils;


import lombok.Data;

import java.util.List;

@Data
public class Result<T> {
    /**
     * 错误码.
     */
    private Integer code;

    /**
     * 提示信息.
     */
    private String msg;

    /**
     * 具体的内容.
     */
    private T data;


    public static Result success(String msg, Object object) {
        Result result = new Result();
        result.setCode(200);
        result.setMsg(msg);
        result.setData(object);
        return result;
    }
    public static Result success1(String message, Object object) {
        Result result = new Result();
        result.setCode(0);
        result.setMsg(message);
        result.setData(object);
        return result;
    }
    public static Result auto(String msg, Object object) {
        Result result = new Result();
        result.setCode(401);
        result.setMsg(msg);
        result.setData(object);
        return result;
    }

    public static Result error(String msg) {
        Result result = new Result();
        result.setCode(500);
        result.setMsg(msg);
        return result;
    }

    public static Result errorCode(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
    public static Result error(String msg,int code) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

}